package com.iakuil.app.mpg;

import cn.hutool.core.io.FileUtil;
import com.iakuil.app.common.core.constant.SysConstant;
import com.iakuil.app.common.core.util.StringUtils;

import java.util.Objects;

/**
 * 代码生成器常量
 *
 * @author Kai
 */
public class GenConstant {

    public static final String BASE_PKG_DIR = StringUtils.replace(SysConstant.BASE_APP_PACKAGE, ".", "/");
    public static final String DB_URL = "jdbc:mysql://bj-cdb-3p38zj4c.sql.tencentcdb.com:26448/ez2biz?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&&rewriteBatchedStatements=true";
    public static final String DB_USERNAME = "root";
    public static final String DB_PASSWD = "Changeme_123";
    public static final String AUTHOR = Objects.toString(System.getProperty("user.name"), "Kai");

    /**
     * 操作的表，逗号分隔
     */
    public static final String TABLE_INCLUDES = "t_xxx";

    /**
     * 项目定制的文件输出目录
     */
    public static final String ROOT_DIR = System.getProperty("user.dir");
    public static final String DTO_PACKAGE = SysConstant.BASE_APP_PACKAGE + ".domain.dto";
    public static final String DTO_OUTPUT_DIR = FileUtil.file(ROOT_DIR, "app-domain", "app-domain-dto", "src/main/java", StringUtils.replace(DTO_PACKAGE, ".", "/")).getAbsolutePath();
    public static final String ENTITY_OUTPUT_DIR = FileUtil.file(ROOT_DIR, "app-domain", "app-domain-entity", "src/main/java", BASE_PKG_DIR + "/domain/entity").getAbsolutePath();
    public static final String MAPPER_OUTPUT_DIR = FileUtil.file(ROOT_DIR, "app-repository", "src/main/java", BASE_PKG_DIR + "/repository/dao").getAbsolutePath();
    public static final String XML_OUTPUT_DIR = FileUtil.file(ROOT_DIR, "app-repository", "src/main/resources/mapper").getAbsolutePath();
    public static final String SERVICE_OUTPUT_DIR = FileUtil.file(ROOT_DIR, "app-service", "src/main/java", BASE_PKG_DIR + "/service").getAbsolutePath();
    public static final String SERV_IMPL_OUTPUT_DIR = FileUtil.file(ROOT_DIR, "app-service", "src/main/java", BASE_PKG_DIR + "/service/impl").getAbsolutePath();
    public static final String CONTR_OUTPUT_DIR = FileUtil.file(ROOT_DIR, "app-api", "src/main/java", BASE_PKG_DIR + "/api/controller").getAbsolutePath();

    public static final String DTO_OUTPUT_KEY = "dtoOutPutDir";
}
